<template>
  <div class="map-item" id="parkingInfo"></div>
</template>

<script>
  import { mapState } from 'vuex'
  import TrafficMap from '../../../../../utils/trafficMap'
  import {getParkingInfo} from '../../../../../utils/http'
  export default {
    computed: {
      ...mapState(['cityInfo'])
    },
    mounted () {
      this.onReady()
    },
    methods: {
      async onReady () {
        const { cityInfo } = this
        const dom = document.getElementById('parkingInfo')
        const Map = new TrafficMap(dom, cityInfo.center, 12, map => {})
        //加载停车场数据
        Map.installParkingInfo(await getParkingInfo(cityInfo.cityCode))
      }
    }
  }
</script>

<style lang="stylus">
  @import './index.styl';
</style>
